﻿using DiIoc.Factory;
using UnityEngine;
using Zenject;

public class Enemy : MonoBehaviour
{
    readonly EnemyManager _enemyManager;
    /// <summary>
    /// note!! we have EnemyManager injected,however , if we use instantiate method 
    /// to create enemy , the injection will NOT excuted.
    /// </summary>
    /// <param name="enemyManager"></param>
    public Enemy(EnemyManager enemyManager)
    {
        Debug.Log($"hey , i am a enemy, i was just created at {System.DateTime.Now}");
        _enemyManager = enemyManager;
        _enemyManager.RegisterEnemy(this);
    }

    public class Factory : PlaceholderFactory<Enemy> { }
}
